package com.vpx.server.framework.utils;

import java.security.MessageDigest;

/**
 * @author liuks
 * @title: vpx
 * @module:
 * @description: 生成密码
 * @date 2021/09/11 16:46
 */
public class Md5Util {

	public static String getMd5Code(String strObj) {
    	try {
			MessageDigest md = MessageDigest.getInstance("MD5"); 
			md.update(strObj.getBytes("utf-8")); 
			byte[] b = md.digest();
			int i; 
			StringBuffer buf = new StringBuffer(""); 
			for (int offset = 0; offset < b.length; offset++) { 
				i = b[offset];
					if(i<0) {
						i+= 256;
					}
					if(i<16) {
						buf.append("0");
					}
				buf.append(Integer.toHexString(i)); 
			}
			return buf.toString();
		}catch (Exception e) {
			e.printStackTrace();
		}
		return "";
    }

	
}
